package com.wuzf.mall.fragment

import android.widget.Toast

// 设置双击两次退出
abstract class MallFragment : BaseFragment() {

    private var lastTime = 0L

    companion object {
        private const val CLICK_TIME = 2000L
    }

    fun exitWithDoubleClick(): Boolean {
        if (System.currentTimeMillis() - lastTime < CLICK_TIME) {
            _mActivity.finish()
        } else {
            lastTime = System.currentTimeMillis()
            Toast.makeText(_mActivity, "双击两次退出", Toast.LENGTH_LONG).show()
        }
        return true
    }

}